package thread.test03;

/**
 * ClassName: SumThread
 * Description:
 *
 * @Author zjl
 * @Create 2025/03/10 19:25
 * @Version 1.0
 */
public class SumThread extends Thread{
    private int start;
    private int end;
    private int sum;
    public SumThread() {
    }
    public SumThread(int start, int end) {
        this.start = start;
        this.end = end;
    }

    public int getSum() {
        return sum;
    }

    @Override
    public void run() {
        int sum = 0;
        for (int i = start; i <= end; i++) {
            sum += i;
        }
        this.sum = sum;
    }
}
